<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib prefix="his_fns" uri="/WEB-INF/tlds/his_fns.tld" %>
<script type="text/javascript">
    function page(n, s) {
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#searchForm").submit();
        return false;
    }
</script>
<div class="app">
    <section class="layout">
        <section class="main-content col-lg-12">
            <div class="content-wrap">
                <div class="wrapper" style="bottom: 50px;">
                    <ul class="nav nav-tabs">
                        <li class="active">
                            <a href="#" onclick="loadDiv('mainCenterDiv','${ctx}/blood/bloodImport/loadBloodStock')">血液库存查询</a>
                        </li>
                    </ul>
                    <section class="panel panel-default">
                        <div class="panel-body">
                            <div class="table-responsive no-border">
                                <div class="datatable-top">
                                    <div class="pull-left">
                                        <form:form id="searchForm" modelAttribute="bloodInpDetail"
                                                   onsubmit="return loadDivForm('mainCenterDiv','searchForm','${ctx}/blood/bloodImport/loadBloodStock');"
                                                   method="post" class="form-inline">
                                            <div class="form-group">
                                                <label class=" control-label">血液成分：</label>
                                                <form:select path="componentId" id="componentId" htmlEscape="false" class="form-control">
                                                    <form:option value=""></form:option>
                                                    <form:options items="${his_fns:getComponentList()}" itemLabel="bloodName" itemValue="id" htmlEscape="false" />
                                                </form:select>
                                            </div>
                                            <div class="form-group">
                                                <label class=" control-label">血型：</label>
                                                <form:select path="patBloodGroup" id="patBloodGroup" htmlEscape="false" class="form-control">
                                                    <form:option value=""></form:option>
                                                    <form:options items="${fns:getDictList('BLOOD_TYPE_DICT')}" itemLabel="label" itemValue="value" htmlEscape="false" />
                                                </form:select>
                                            </div>
                                            <div class="form-group">
                                                <button class="btn btn-primary" id="searchbloodStock" type="submit">查询</button>
                                            </div>
                                        </form:form>
                                    </div>
                                </div>
                                <table id="contentTable" class="table table-bordered table-striped mg-t datatable">
                                    <thead>
                                    <tr>
                                        <th>入库单号</th>
                                        <th>血袋号</th>
                                        <th>血型</th>
                                        <th>RH</th>
                                        <th>血液成分</th>
                                        <th>储血量</th>
                                        <th>单位</th>
                                        <th>采血日期</th>
                                        <th>有效期</th>
                                        <th>献血者</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach items="${list}" var="bloodInpDetail">
                                        <tr>
                                            <td>${bloodInpDetail.bloodInpMaster.inpNo}</td>
                                            <td>${bloodInpDetail.bloodId}</td>
                                            <td>${fns:getDictLabel(bloodInpDetail.patBloodGroup,'BLOOD_TYPE_DICT' ,'')}</td>
                                            <td>${fns:getDictLabel(bloodInpDetail.rh,'rh_dict' ,'')}</td>
                                            <td>${his_fns:getBloodComponentName(bloodInpDetail.componentId)}</td>
                                            <td>${bloodInpDetail.bloodCapacity}</td>
                                            <td>${fns:getDictLabel(bloodInpDetail.units, 'BLOOD_UNIT_DICT', '')}</td>
                                            <td><fmt:formatDate value="${bloodInpDetail.bloodGatherDate}" pattern="yyyy-MM-dd" /></td>
                                            <td><fmt:formatDate value="${bloodInpDetail.invalDate}" pattern="yyyy-MM-dd" /></td>
                                            <td>${bloodInpDetail.bloodDonorName}</td>
                                        </tr>
                                    </c:forEach>
                                </table>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </section>
    </section>
</div>
